<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/4/20
 * Time: 9:27
 */

namespace app\server;
use rap\db\DB;
use rap\db\Record;

class StickPic extends Record
{
    public function addStickPicInfo ($data) {

        $res = DB::insert('mp_stick_pic', $data);

        return $res;
    }

    public function getStickPicList ($where, $field, $page) {

        $limit = $page * 10;
        $data = DB::select('mp_stick_pic')
            ->order('create_time desc')
            ->limit( $limit, 10)
            ->where($where)
            ->fields($field)
            ->findAll();

        return $data;
    }

    public function updateOrderInfo($where, $data) {

        $sql = DB::update('mp_stick_pic');
        foreach ($data as $k => $v) {
            $sql = $sql->set($k, $v);
        }
        $res =$sql->where($where)->excuse();

        return $res;
    }

    public function getStickCarNumber($where, $field) {
        $data = DB::select('mp_stick_carnumber')
            ->where($where)
            ->fields('*')
            ->find();

        return $data;
    }
}